package com.axiu;


import android.app.Fragment;
import android.content.Intent;
import android.os.Bundle;
import android.provider.MediaStore;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;


/**
 * A simple {@link Fragment} subclass.
 */
public class HomeFragment extends Fragment {

    public LinearLayout verify;
    public LinearLayout evidence;
    public LinearLayout photograph;
    public LinearLayout videotape;
    public LinearLayout sound_record;
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View view = inflater.inflate(R.layout.fragment_home, container, false);
        TextView username = (TextView) view.findViewById(R.id.username);
        username.setVisibility(View.GONE);
        TextView title = (TextView) this.getActivity().findViewById(R.id.top_bar_title);
        //title.setText("时间戳验证");
        photograph = (LinearLayout) view.findViewById(R.id.photograph);
        videotape = (LinearLayout) view.findViewById(R.id.videotape);
        sound_record = (LinearLayout) view.findViewById(R.id.sound_record);
        verify = (LinearLayout) view.findViewById(R.id.verify);
        evidence = (LinearLayout) view.findViewById(R.id.evidence);
        photograph.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
                startActivityForResult(intent, 1);
            }
        });
        videotape.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
                startActivityForResult(intent, 1);
            }
        });
        sound_record.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MediaStore.Audio.Media.RECORD_SOUND_ACTION);
                startActivityForResult(intent, 1);
            }
        });
        verify.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(getActivity(), VerifyActivity.class);
                startActivity(intent);
            }
        });
        evidence.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(getActivity(), EvidenceActivity.class);
                startActivity(intent);
            }
        });
        Button login = (Button) view.findViewById(R.id.login);
        login.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(getActivity(), LoginActivity.class);
                startActivity(intent);
            }
        });
        return view;
    }

}
